home *** CD-ROM | disk | FTP | other *** search
- Path: news.spies.com!usenet
- From: Erik Max Francis <max@alcyone.com>
- Newsgroups: comp.lang.c
- Subject: Re: Q: pointer to const
- Date: Fri, 29 Mar 1996 14:35:44 -0800
- Organization: Alcyone Systems
- Message-ID: <315C65C0.454B4982@alcyone.com>
- References: <4jcvo0$9v9@zephyr.cerfacs.fr>
- NNTP-Posting-Host: newton.alcyone.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i486)
-
- Muller Jens Dominik wrote:
-
- > void chk_cnst ( const double *Pdata )
- > {
- > double *Psome ;
- > Psome = Pdata ;
- > }
- >
- > cc -c t2.c
- > cfe: Warning 709: t2.c, line 4: Incompatible pointer type assignment
- > Psome = Pdata ;
- > --------^
-
- It's because you're implicitly casting a const pointer to a non-const pointer.
- Either declare the locally-defined variable to a const pointer, or explicitly
- cast it to a non-const pointer when assigning it to the local variable.
-
- --
- Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max@alcyone.com
- San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
- H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
- Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
- "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
-